﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Entities;
using System.Data;
using Data;

namespace Presentation
{
    public partial class CheckBalance : System.Web.UI.Page
    {
        CardsEntity card = new CardsEntity();
        protected void Page_Load(object sender, EventArgs e)
        {
            AccountsEntity cE = new AccountsEntity();
            cE.AccountID = (int)Session["AccountID"];
            AccountBLL acc = new AccountBLL();
            checkBalance.Text = acc.getAccount(cE).ToString();
            checkBalance.Dispose();
        }
        protected void bntOk_Click(object sender, EventArgs e)
        {
            LogBLL log = new LogBLL();
            string CardNo = Session["CardNo"].ToString();
            log.InsertLog(CardNo);
            string message = "Your receipt print successful.";
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("alert('");
            sb.Append(message);
            sb.Append("');");
            sb.Append("</script>");
            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
        }
        protected void bntCancel_Click(object sender, EventArgs e)
        {
            LogBLL log = new LogBLL();
            string CardNo = Session["CardNo"].ToString();
            log.InsertLog(CardNo);
            Response.Redirect("MainPage.aspx");
        }
    }
}